﻿using System.Runtime.Serialization;
using UnityEngine;
using UnityEngine.Scripting;

namespace GMME.Model.Rtm.Notify
{
    [DataContract]
    public class RtmConnectionStatusNotify
    {
        [DataMember(Name = "status")]
        [Preserve]
        public int Status { get; set; }

        [DataMember(Name = "reason")]
        [Preserve]
        public string Reason { get; set; }

#if UNITY_ANDROID
        internal static RtmConnectionStatusNotify ConvertRtmConnectionStatusNotify(AndroidJavaObject javaObject)
        {
            if (javaObject != null)
            {
                var notify = new RtmConnectionStatusNotify();
                notify.Status = javaObject.Call<int>("getStatus");
                notify.Reason = javaObject.Call<string>("getReason");
                return notify;
            }

            return null;
        }
#endif
    }
}